/*
 * @(#)MaintFormRecordForm.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.form.web;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;

import com.dcivision.form.bean.FormRecord;
import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.GlobalConstant;
import com.dcivision.framework.TextUtility;
import com.dcivision.framework.bean.AbstractBaseObject;
import com.dcivision.framework.web.AbstractActionForm;

/**
  MaintFormRecordForm.java

  This class is the for web form purpose.

  @author      Scott Tong
  @company     DCIVision Limited
  @creation date   16/12/2003
  @version     $Revision: 1.18 $
*/

public class MaintFormRecordForm extends AbstractActionForm {

  public static final String REVISION = "$Revision: 1.18 $";

  private String formCode = null;
  private String formVersion = null;
  private String formType = null;
  private String formDocID = null;
  private String formGroupID = null;
  private String title = null;
  private String titleAlt = null;
  private String description = null;
  private String descriptionAlt = null;
  private String status = GlobalConstant.RECORD_PENDING;
  private String startDate = null;
  private String endDate = null;
  private Integer displayElementID = null;
  private String formCategoryID = null;
  private String trackClass = null;
  private String submissionClass = null;
  private String autoNumbering = "F";
  private String lastPageCode = null;
  private String titleFontColor = null;
  private String titleFontSize = null;
  private String titleFontType = null;
  private String titleFontStyle = null;
  private String titlePosition = null;
  private FormFile uploadFile=null;
  
  //Form referenceID
//  private String prefix = null;
//  private String suffix = null;
//  private String start_no = "0";
//  private String current_no = null;
//  private String length = "10";
//  private String increment = "1";


  private Integer pageID = null;
  private String pageTitle = null;
  private List formSectionList = null;
  private List formSectionElementList = null;
  
  public MaintFormRecordForm() {
    super();
  }


    public String getTitleFontColor() {
      return(this.titleFontColor);
    }

    public void setTitleFontColor(String titleFontColor) {
      this.titleFontColor = titleFontColor;
    }

    public String getTitleFontSize() {
      return(this.titleFontSize);
    }

    public void setTitleFontSize(String titleFontSize) {
      this.titleFontSize = titleFontSize;
    }

    public String getTitleFontType() {
      return(this.titleFontType);
    }

    public void setTitleFontType(String titleFontType) {
      this.titleFontType = titleFontType;
    }

    public String getTitleFontStyle() {
      return(this.titleFontStyle);
    }

    public void setTitleFontStyle(String titleFontStyle) {
      this.titleFontStyle = titleFontStyle;
    }

    public String getTitlePosition() {
      return(this.titlePosition);
    }

    public void setTitlePosition(String titlePosition) {
      this.titlePosition= titlePosition;
    }

    public FormFile getUploadFile()
    {
      return (this.uploadFile) ;


    }

    public  void  setUploadFile(FormFile uploadFile)
    {
      this.uploadFile=uploadFile;
    }
    
  public String getFormCode() {
    return(this.formCode);
  }

  public void setFormCode(String formCode) {
    this.formCode = formCode;
  }

  public String getFormVersion() {
    return(this.formVersion);
  }

  public void setFormVersion(String formVersion) {
    this.formVersion = formVersion;
  }

  public String getFormType() {
    return(this.formType);
  }

  public void setFormType(String formType) {
    this.formType = formType;
  }

  public String getFormDocID() {
    return(this.formDocID);
  }

  public void setFormDocID(String formDocID) {
    this.formDocID = formDocID;
  }


  public String getFormGroupID() {
    return(this.formGroupID);
  }

  public void setFormGroupID(String formGroupID) {
    this.formGroupID = formGroupID;
  }
  
  public String getTitle() {
    return(this.title);
  }

  public void setTitle(String title) {
    this.title = title;
  }

  public String getTitleAlt() {
    return(this.titleAlt);
  }

  public void setTitleAlt(String titleAlt) {
    this.titleAlt = titleAlt;
  }

  public String getDescription() {
    return(this.description);
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public String getDescriptionAlt() {
    return(this.descriptionAlt);
  }

  public void setDescriptionAlt(String descriptionAlt) {
    this.descriptionAlt = descriptionAlt;
  }

  public String getStatus() {
    return(this.status);
  }

  public void setStatus(String status) {
    this.status = status;
  }

  public String getStartDate() {
    return(this.startDate);
  }

  public void setStartDate(String startDate) {
    this.startDate = startDate;
  }

  public String getEndDate() {
    return(this.endDate);
  }

  public void setEndDate(String endDate) {
    this.endDate = endDate;
  }
  
  public Integer getDisplayElementID() {
    return displayElementID;
  }

  public void setDisplayElementID(Integer displayElementID) {
    this.displayElementID = displayElementID;
  }
  
  public String getFormCategoryID() {
    return(this.formCategoryID);
  }

  public void setFormCategoryID(String formCategoryID) {
    this.formCategoryID = formCategoryID;
  }

  public String getTrackClass() {
    return(this.trackClass);
  }

  public void setTrackClass(String trackClass) {
    this.trackClass = trackClass;
  }

  public String getSubmissionClass() {
    return(this.submissionClass);
  }

  public void setSubmissionClass(String submissionClass) {
    this.submissionClass = submissionClass;
  }

  public String getAutoNumbering() {
    return(this.autoNumbering);
  }

  public void setAutoNumbering(String autoNumbering) {
    this.autoNumbering = autoNumbering;
  }

  public String getLastPageCode() {
    return(this.lastPageCode);
  }

  public void setLastPageCode(String lastPageCode) {
    this.lastPageCode = lastPageCode;
  }

  public Integer getPageID() {
    return(this.pageID);
  }

  public void setPageID(Integer pageID) {
    this.pageID = pageID;
  }
  
  public String getPageTitle() {
    return(this.pageTitle);
  }

  public void setPageTitle(String pageTitle) {
    this.pageTitle = pageTitle;
  }

  public void setFormSectionList(List FormSectionList) {
    this.formSectionList = FormSectionList;
  }

  public List getFormSectionList() {
    return (this.formSectionList);
  }
  
//  public void setPrefix(String pre){
//  	this.prefix=pre;
//  }
//  public String getPrefix(){
//  	return this.prefix;
//  }
//  
//  public void setSuffix(String suf){
//  	this.suffix=suf;
//  }
//  public String getSuffix(){
//  	return this.suffix;
//  }
//  
//  public void setStart_no(String number){
//  	this.start_no=number;
//  }
//  public String getStart_no(){
//  	return this.start_no;
//  }
//  
//  public void setCurrent_no(String number){
//  	this.current_no=number;
//  }
//  public String getCurrent_no(){
//  	return this.current_no;
//  }
//  
//  public void setLength(String len){
//  	this.length=len;
//  }
//  public String getLength(){
//  	return this.length;
//  }
//  
//  public void setIncrement(String inc){
//  	this.increment=inc;
//  }
//  public String getIncrement(){
//  	return this.increment;
//  }

  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    return super.validate(mapping, request);
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);
    this.setID(null);
    this.setFormCode(null);
    this.setFormVersion(null);
    this.setFormType(null);
    this.setFormDocID(null);
    this.setFormGroupID(null);
    this.setPageID(null);
    this.setTitle(null);
    this.setTitleAlt(null);
    this.setDescription(null);
    this.setDescriptionAlt(null);
    this.setStatus(GlobalConstant.RECORD_PENDING);
    this.setStartDate(null);
    this.setEndDate(null);
    this.setDisplayElementID(null);
    this.setFormCategoryID(null);
    this.setTrackClass(null);
    this.setSubmissionClass(null);
    this.setAutoNumbering("F");
    this.setLastPageCode(null);
    this.setRecordStatus(null);
    this.setUpdateCount(null);
    this.setCreatorID(null);
    this.setCreateDate(null);
    this.setUpdaterID(null);
    this.setUpdateDate(null);
//    this.setPrefix(null);
//    this.setSuffix(null);
//    this.setStart_no("0");
//    this.setCurrent_no(null);
//    this.setLength("10");
//    this.setIncrement("1");
  }

  public AbstractBaseObject getFormData() throws ApplicationException {
    FormRecord tmpFormRecord = new FormRecord();
    tmpFormRecord.setID(TextUtility.parseIntegerObj(this.getID()));
    tmpFormRecord.setFormCode(this.getFormCode());
    tmpFormRecord.setFormVersion(this.getFormVersion());
    tmpFormRecord.setFormType(TextUtility.parseIntegerObj(this.getFormType()));
    tmpFormRecord.setFormDocID(TextUtility.parseIntegerObj(this.getFormDocID()));    
    tmpFormRecord.setFormGroupID(TextUtility.parseIntegerObj(this.getFormGroupID()));
    tmpFormRecord.setPageID(this.getPageID());
    tmpFormRecord.setTitle(this.getTitle());
    tmpFormRecord.setTitleAlt(this.getTitleAlt());
    tmpFormRecord.setDescription(this.getDescription());
    tmpFormRecord.setDescriptionAlt(this.getDescriptionAlt());
    tmpFormRecord.setStatus(this.getStatus());
    tmpFormRecord.setStartDate(parseTimestamp(this.getStartDate()));
    tmpFormRecord.setEndDate(parseTimestamp(this.getEndDate()));
    tmpFormRecord.setDisplayElementID(this.displayElementID);
    tmpFormRecord.setFormCategoryID(TextUtility.parseIntegerObj(this.getFormCategoryID()));
    tmpFormRecord.setTrackClass(this.getTrackClass());
    tmpFormRecord.setSubmissionClass(this.getSubmissionClass());
    tmpFormRecord.setAutoNumbering(this.getAutoNumbering());
    tmpFormRecord.setLastPageCode(this.getLastPageCode());
    tmpFormRecord.setRecordStatus(this.getRecordStatus());
    tmpFormRecord.setUpdateCount(TextUtility.parseIntegerObj(this.getUpdateCount()));
    tmpFormRecord.setCreatorID(TextUtility.parseIntegerObj(this.getCreatorID()));
    tmpFormRecord.setCreateDate(parseTimestamp(this.getCreateDate()));
    tmpFormRecord.setUpdaterID(TextUtility.parseIntegerObj(this.getUpdaterID()));
    tmpFormRecord.setUpdateDate(parseTimestamp(this.getUpdateDate()));
//    tmpFormRecord.setPrefix(this.getPrefix());
//    tmpFormRecord.setSuffix(this.getSuffix());
//    tmpFormRecord.setStart_no(TextUtility.parseIntegerObj(this.getStart_no()));
//    tmpFormRecord.setCurrent_no(TextUtility.parseIntegerObj(this.getCurrent_no()));
//    tmpFormRecord.setLength(TextUtility.parseIntegerObj(this.getLength()));
//    tmpFormRecord.setIncrement(TextUtility.parseIntegerObj(this.getIncrement()));
    return tmpFormRecord;
  }

  public void setFormData(AbstractBaseObject baseObj) throws ApplicationException {
    FormRecord tmpFormRecord = (FormRecord)baseObj;
    this.setID(TextUtility.formatIntegerObj(tmpFormRecord.getID()));
    this.setFormCode(tmpFormRecord.getFormCode());
    this.setFormVersion(tmpFormRecord.getFormVersion());
    this.setFormType(TextUtility.formatIntegerObj(tmpFormRecord.getFormType()));
    this.setFormDocID(TextUtility.formatIntegerObj(tmpFormRecord.getFormDocID()));
    this.setFormGroupID(TextUtility.formatIntegerObj(tmpFormRecord.getFormGroupID()));
    this.setPageID(tmpFormRecord.getPageID());
    this.setTitle(tmpFormRecord.getTitle());
    this.setTitleAlt(tmpFormRecord.getTitleAlt());
    this.setDescription(tmpFormRecord.getDescription());
    this.setDescriptionAlt(tmpFormRecord.getDescriptionAlt());
    this.setStatus(tmpFormRecord.getStatus());
    this.setStartDate(formatTimestamp(tmpFormRecord.getStartDate()));
    this.setEndDate(formatTimestamp(tmpFormRecord.getEndDate()));
    this.setDisplayElementID(tmpFormRecord.getDisplayElementID());
    this.setFormCategoryID(TextUtility.formatIntegerObj(tmpFormRecord.getFormCategoryID()));
    this.setTrackClass(tmpFormRecord.getTrackClass());
    this.setSubmissionClass(tmpFormRecord.getSubmissionClass());
    this.setAutoNumbering(tmpFormRecord.getAutoNumbering());
    this.setLastPageCode(tmpFormRecord.getLastPageCode());
    this.setRecordStatus(tmpFormRecord.getRecordStatus());
    this.setUpdateCount(TextUtility.formatIntegerObj(tmpFormRecord.getUpdateCount()));
    this.setCreatorID(TextUtility.formatIntegerObj(tmpFormRecord.getCreatorID()));
    this.setCreateDate(formatTimestamp(tmpFormRecord.getCreateDate()));
    this.setUpdaterID(TextUtility.formatIntegerObj(tmpFormRecord.getUpdaterID()));
    this.setUpdateDate(formatTimestamp(tmpFormRecord.getUpdateDate()));
//    this.setPrefix(tmpFormRecord.getPrefix());
//    this.setSuffix(tmpFormRecord.getSuffix());
//    this.setStart_no(TextUtility.formatIntegerObj(tmpFormRecord.getStart_no()));
//    this.setCurrent_no(TextUtility.formatIntegerObj(tmpFormRecord.getCurrent_no()));
//    this.setLength(TextUtility.formatIntegerObj(tmpFormRecord.getLength()));
//    this.setIncrement(TextUtility.formatIntegerObj(tmpFormRecord.getIncrement()));
  }

  public List getFormSectionListData() throws ApplicationException {
    List tmpFormSectionList = this.getFormSectionList();
    return tmpFormSectionList;
  }

  public void setFormSectionListData(List sectionList) throws ApplicationException {
    List formSectionList = sectionList;
    this.setFormSectionList(formSectionList);
  }



}
